package com.linciping.gradle.inject.view

import com.android.build.gradle.AppExtension
import org.gradle.api.Plugin
import org.gradle.api.Project

class InjectPlugin : Plugin<Project> {
    override fun apply(project: Project) {
        try {
            val injectExtension = InjectExtension()
            project.extensions.add(InjectExtension::class.java, "injectConfig", injectExtension)
            val appExtension = project.extensions.getByType(AppExtension::class.java)
            val injectTransform = InjectTransform(injectExtension)
            appExtension.registerTransform(injectTransform)
        } catch (ex: Exception) {
            println("project no app module")
        }
    }
}